import { Button, Typography } from "@mui/material";
import {
    Box,
    Chip,
    FormControl,
    Grid,
    Paper,
    TextField,
    useTheme,
  } from "@mui/material";
import React, { useEffect } from "react";
import { useState } from "react";
import FindFail from "../../../components/FindFail";
import MyDialog from "../../../components/MyDialog";

export default function Score(props) {
  const [open, setOpen] = useState(false);

  return (
    <div>
      <Button color={props.value.totalScore>=60?"primary":"error" } variant="text" onClick={() => setOpen(true)}>
        {props.value.totalScore}
      </Button>
      <MyDialog
        open={open}
        title="考试成绩"
        onClose={() => {
          setOpen(false);
        }}
      >
        {props.field == "score" && (
        <Box>
        <Typography>
            总成绩:<Typography variant="body1" color="primary" component="span" sx={{marginLeft: 1}}>{props.value.totalScore}</Typography>
        </Typography>
        <Typography>
          平时成绩（占比30%）:<Typography variant="body1" color="primary" component="span" sx={{marginLeft: 1}}>{props.value.usualScore}</Typography>
        </Typography>
        <Typography>
          期末考试成绩（占比70%）:<Typography variant="body1" color="primary" component="span" sx={{marginLeft: 1}}>{props.value.testScore}</Typography>
        </Typography>
        </Box>
        )}
      </MyDialog>
    </div>
  );
}